package com.hermes.test;

import java.util.Date;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.hermes.biz.common.model.comment.FbckDO;
import com.hermes.biz.manager.comment.FbackManager;
import com.hermes.common.util.ParameterParserUtil;
import com.opensymphony.xwork2.ActionSupport;

public class FeedSet  extends ActionSupport{
	
	public FbackManager fbackManager;
	public FbckDO fbckDO;

	
	@Override
	public String execute() throws Exception {
		//user增加反馈字段
		String longlongago = "1888-8-8";
		String hdesc = ParameterParserUtil.getParameter("hdesc");
		String userid = ParameterParserUtil.getParameter("userid");
		fbckDO = new FbckDO();
		String ip = ParameterParserUtil.getUserIpAddress();
		Date dt = new Date();
			
		fbckDO.setStatus(0);
		
		fbckDO.setIp(ip);
		fbckDO.setContent(hdesc);			
		
		long resultCode = (Long) fbackManager.insertNewComment(fbckDO);
		
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setContentType("text/html;charset=utf-8");				
		if(resultCode>0){
			response.getWriter().print("ok"); 
		}else{
			response.getWriter().print("faild"); 
		}
		
		response.getWriter().flush();
		response.getWriter().close();
			
	    return SUCCESS;		
	}
	
	//getters and setters
	public FbackManager getFbackManager() {
		return fbackManager;
	}

	public void setFbackManager(FbackManager fbackManager) {
		this.fbackManager = fbackManager;
	}

	public FbckDO getFbckDO() {
		return fbckDO;
	}

	public void setFbckDO(FbckDO fbckDO) {
		this.fbckDO = fbckDO;
	}

}
